<template>
  <basic-container>
    <collect-list ref="listRef" v-show="showType==='list'" @add="handleAdd" @detail="handleDetail"></collect-list>
    <collect-detail :id="detailId" v-if="showType==='detail'" @back="handleBack"></collect-detail>
  </basic-container>
</template>

<script>

import CollectList from "@/views/product/component/CollectList";
import CollectDetail from "@/views/product/component/CollectDetail";
export default {
  name: "index",
  components: {CollectDetail, CollectList},
  data() {
    return {
      showType: 'list',
      detailId: ''
    }
  },
  methods: {
    handleBack(flag){
      this.showType = 'list'
      if(flag) this.$refs.listRef.refresh()
    },
    handleAdd() {
      this.showType = 'add'
    },
    handleDetail(_id) {
      this.showType = 'detail'
      this.detailId = _id
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
